﻿<UserControl x:Class="Mayhem.UserControls.ErrorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:src="clr-namespace:Mayhem.UserControls"
             mc:Ignorable="d" 
             x:Name="MayhemErrorView"
             Background="Transparent"
             MouseLeave="MayhemErrorView_MouseLeave"
             MouseMove="MayhemErrorView_MouseMove"
             >
    
    <UserControl.Resources>
        <Style x:Key="SeparatorStyle" TargetType="{x:Type Border}">
            <Setter Property="BorderThickness" Value="1,0,0,0"/>
            <Setter Property="BorderBrush" Value="#A5A5A5A5"/>
            <Setter Property="Margin" Value="10,0,10,0"/>
            <Setter Property="Width" Value="2"/>
            <Setter Property="Background" Value="White"/>
        </Style>
        <src:SingleAnalysisStatusConverter x:Key="statusconverter" />
        <DataTemplate x:Key="errorStyle" >
            <StackPanel Orientation="Horizontal" MouseDown="Errors_MouseDown">
                <Image HorizontalAlignment="Right" Height="16" Width="16" Margin="0,0,10,0"
                         Source="{Binding Type, Converter={StaticResource statusconverter}}"
                          VerticalAlignment="Bottom" Stretch="Fill" />
                <Border Style="{StaticResource SeparatorStyle}" />
                <TextBlock Text="{Binding TimeString}" Margin="0,0,10,0"/>
                <Border Style="{StaticResource SeparatorStyle}" />
                <TextBlock Text="{Binding Message}" />
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
        <StackPanel>
            <Border Name="borderNumber" BorderThickness="1,1,1,0"  BorderBrush="Black" Height="30"  HorizontalAlignment="Right" Background="White" MouseDown="Border_MouseDown" CornerRadius="10,10,0,0">
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,0,8,0" FontSize="24" Text="{Binding Path=Errors.Count, ElementName=MayhemErrorView}" />
            </Border>
            <Border Name="borderListBox" BorderThickness="0,1,0,0" BorderBrush="Black" Height="130" MouseDown="Errors_MouseDown">
                <ListBox Name="listErrors" ItemTemplate="{StaticResource errorStyle}" ItemsSource="{Binding Path=Errors, ElementName=MayhemErrorView}" FontSize="14">
                </ListBox>
            </Border>
        </StackPanel>
</UserControl>
